/**
 * 
 */
package de.cbf.cam.dsa.model.entities.weapon.valueModifier;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

import de.cbf.cam.dsa.model.entities.weapon.OneWeapon;
import de.cbf.cam.dsa.model.entities.weapon.WeaponMelee;

/**
 * @author Nebelritter
 *
 */
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class WeaponWMModifier extends WeaponValueModifier{
	/**
	 * @uml.property  name="atMod"
	 */
	private int atMod;
	/**
	 * @uml.property  name="paMod"
	 */
	private int paMod;
	/**
	 * 
	 */
	public WeaponWMModifier(int type,int atMod, int paMod) {
		super(type);
		this.atMod=atMod;
		this.paMod=paMod;
	}

	@Override
	public void modifyWeaponValue(OneWeapon weapon) {
		if (weapon instanceof WeaponMelee) {
			WeaponMelee weaponMelee = (WeaponMelee) weapon;
			weaponMelee.setWmAT(weaponMelee.getWmAT()+atMod);
			weaponMelee.setWmPA(weaponMelee.getWmPA()+paMod);
		}			
	}

	@Override
	public void unModifyWeaponValue(OneWeapon weapon) {
		if (weapon instanceof WeaponMelee) {
			WeaponMelee weaponMelee = (WeaponMelee) weapon;
			weaponMelee.setWmAT(weaponMelee.getWmAT()-atMod);
			weaponMelee.setWmPA(weaponMelee.getWmPA()-paMod);
		}	
	}

	/**
	 * @return
	 * @uml.property  name="atMod"
	 */
	public int getAtMod() {
		return atMod;
	}

	/**
	 * @param atMod
	 * @uml.property  name="atMod"
	 */
	public void setAtMod(int atMod) {
		this.atMod = atMod;
	}

	/**
	 * @return
	 * @uml.property  name="paMod"
	 */
	public int getPaMod() {
		return paMod;
	}

	/**
	 * @param paMod
	 * @uml.property  name="paMod"
	 */
	public void setPaMod(int paMod) {
		this.paMod = paMod;
	}	
}
